import fetch from 'utils/fetch';

//1.    代理商初审或复核结算列表
export function listAgentSettlement(
    page,
    rows,
    flag,
    provinceId,
    cityId,
    areaId,
    agentName,
    startTime,
    endTime,
    firstStatus,
    recheckStatus
) {
    const data = {
        page, //页数
        rows, //页内行数
        flag, //1表示初审的结算列表 2表示复核的结算列表
        provinceId, //省id
        cityId, //市id
        areaId, //区id
        agentName, //负责人姓名
        startTime, //申请开始时间
        endTime, //申请结束时间
        firstStatus, //初审状态 he 复核状态
        recheckStatus
    }
    return fetch({
        url: '/agent/listAgentSettlement',
        method: 'post',
        data
    });
}

//2.    计算n笔申请的总额

export function count(idList) {
    const data = {
        idList
    }

    return fetch({
        url: "/agent/count",
        method: "post",
        data
    })
}

//批量审核通过

export function check(flag, idList) {
    const data = {
        flag,
        idList
    }

    return fetch({
        url: "/agent/batch/check",
        method: "post",
        data
    })
}

//4、初审
export function checkfirst(pId, flag, firstReject) {
    const data = {
        pId,
        flag,
        firstReject
    }

    return fetch({
        url: "/agent/first/check",
        method: "post",
        data
    })
}

//结算区间充值明细

export function listPayIncrementDetailInfo(
    intervalStartTime,
    intervalEndTime,
    pId,
    page,
    rows
) {
    const data = {
        intervalStartTime,
        intervalEndTime,
        pId,
        page,
        rows
    }

    return fetch({
        url: "/agent/listPayIncrementDetailInfo",
        method: "post",
        data
    })
}

//更多信息经销区域
export function listAgentProvinces(userId) {
    const data = {
        userId
    }

    return fetch({
        url: `/agent/listAgentProvinces/${userId}`,
        method: "post",
        data
    })
}

//获取经销商当前结算信息

export function getSettlementAgentData(
    flag,
    orgUserId,
    pId
) {
    const data = {
        flag,
        orgUserId,
        pId
    }

    return fetch({
        url: "/agent/getSettlementAgentData",
        method: "post",
        data
    })
}

//复核

export function recheck(
    pId,
    flag,
    recheckReject
) {
    const data = {
        pId,
        flag,
        recheckReject
    }

    return fetch({
        url: "/agent/recheck",
        method: "post",
        data
    })
}

//转账详情列表

export function detail(
    page, //页数
    rows, //页内行数
    flag, //转账详情标记
    provinceId, //省id
    cityId, //市id
    areaId, //区id
    agentName, //负责人姓名
    accountName, //银行卡姓名
    bankCard, //银行卡号
    status, //当前进程
    startTime, //申请开始时间 he /申请结束时间
    endTime
) {
    const data = {
        page,
        rows,
        flag,
        provinceId,
        cityId,
        areaId,
        agentName,
        accountName,
        bankCard,
        status,
        startTime,
        endTime
    }

    return fetch({
        url: "/agent/transfer/detail",
        method: "post",
        data
    })
}

//刷新查询

export function refreshQuery(
    pId
) {
    const data = {
        pId
    }
    return fetch({
        url: "/agent/refreshQuery",
        method: "post",
        data
    })
}

//待处理
export function apply(
    flag,
    pId
) {
    const data = {
        flag,
        pId
    }
    return fetch({
        url: "/agent/deal/apply",
        method: "post",
        data
    })
}

//转账确认

export function transfer(
    flag,
    pId,
    reason
) {
    const data = {
        flag,
        pId,
        reason
    }

    return fetch({
        url: "/agent/affirm/transfer",
        method: "post",
        data
    })
}

//查看进程

export function process(
    pId
) {
    const data = {
        pId
    }

    return fetch({
        url: "/agent/look/process",
        method: "post",
        data
    })
}

// 一卡通

//1.一卡通初审或复核结算列表
export function pageCardSettlement(
    page, //页数
    rows, //页内行数
    flag, //1表示初审的结算列表 2表示复核的结算列表
    provinceId, //省id
    cityId, //市id
    areaId, //区id
    schoolId, //学校id
    startTime, //申请开始时间
    endTime, //申请结束时间
    firstStatus, //初审状态（"recheckStatus": ""//复核状态）
    recheckStatus
) {
    const data = {
        page, //页数
        rows, //页内行数
        flag, //1表示初审的结算列表 2表示复核的结算列表
        provinceId, //省id
        cityId, //市id
        areaId, //区id
        schoolId, //学校id
        startTime, //申请开始时间
        endTime, //申请结束时间
        firstStatus, //初审状态（"recheckStatus": ""//复核状态）
        recheckStatus
    }

    /*  
        一卡通接口 settlement地址批量添加了card路径 20180529
        tips:
            原路径: /settlement/pageCardSettlement
            现  在:  /card/settlement/pageCardSettlement
        批量添加card路径 shanwj 
    */ 
    return fetch({
        url: "/card/settlement/pageCardSettlement",
        method: "post",
        data
    })
}

//一卡通 2.	计算n笔申请的总额

export function settlementCount(idList) {
    const data = {
        idList
    }
    return fetch({
        url: "/card/settlement/count",
        method: "post",
        data
    })
}

//一卡通 3.	批量审核通过

export function batchCheck(flag, idList) {
    const data = {
        flag,
        idList
    }
    return fetch({
        url: "/card/settlement/batch/check",
        method: "post",
        data
    })
}

//一卡通 3.	初审
export function firstCheck(pId, flag, firstReject) {
    const data = {
        pId,
        flag,
        firstReject
    }
    return fetch({
        url: "/card/settlement/first/check",
        method: "post",
        data
    })
}


//一卡通 3.	复核
export function settlementrecheck(pId, flag, recheckReject) {
    const data = {
        pId,
        flag,
        recheckReject
    }
    return fetch({
        url: "/card/settlement/recheck",
        method: "post",
        data
    })
}

//一卡通 查看表格

export function pageSettlementDetail(
    sBeginTime,
    sEndTime,
    fSchoolId,
    page,
    rows
) {
    const data = {
        sBeginTime,
        sEndTime,
        fSchoolId,
        page,
        rows
    }

    return fetch({
        url: "/card/settlement/pageSettlementDetail",
        method: "post",
        data
    })
}

//根据结算申请的id查询简要信息

export function getSettlementById(
    flag,
    pId
) {
    const data = {
        flag,
        pId
    }

    return fetch({
        url: "/card/settlement/getSettlementById",
        method: "post",
        data
    })
}


//转账详情列表

export function transferDetail(
    page, //页数
    rows, //页内行数
    flag, //转账详情标识
    provinceId, //省id
    cityId, //市id
    areaId, //区id
    schoolId, //学校id
    startTime, //申请开始时间
    endTime, //申请结束时间
    accountName, //银行卡姓名
    bankCard, //银行卡号
    status //当前进程

) {
    const data = {
        page, //页数
        rows, //页内行数
        flag, //转账详情标识
        provinceId, //省id
        cityId, //市id
        areaId, //区id
        schoolId, //学校id
        startTime, //申请开始时间
        endTime, //申请结束时间
        accountName, //银行卡姓名
        bankCard, //银行卡号
        status
    }

    return fetch({
        url: "/card/settlement/transfer/detail",
        method: "post",
        data
    })
}

//一卡通 刷新查询

export function settlementRefreshQuery(
    pId
) {
    const data = {
        pId
    }

    return fetch({
        url: "/card/settlement/refreshQuery",
        method: "post",
        data
    })
}

//一卡通待处理

export function dealapply(
    flag,
    pId
) {
    const data = {
        flag,
        pId
    }

    return fetch({
        url: "/card/settlement/deal/apply",
        method: "post",
        data
    })
}

//一卡通 转账确认

export function affirmtransfer(
    flag,
    pId,
    reason
) {
    const data = {
        flag,
        pId,
        reason
    }

    return fetch({
        url: "/card/settlement/affirm/transfer",
        method: "post",
        data
    })
}

//一卡通 查看进程

export function lookProcess(
    pId
) {
    const data = {
        pId
    }

    return fetch({
        url: "/card/settlement/look/process",
        method: "post",
        data
    })
}